// 统一的接口配置文件： 便于后期的维护 修改
import { Request } from "../utils/request"

//登录接口
export  const  login = (data) => Request({
    url: `/api/user/login.do`,
    method:"post",
    params:data
})
//主页请求

export  const  home = () => Request({
    url: `/api/statistic/base_count.do`,
    method:"get",
})


//用户列表接口
export  const  users = (data) => Request({
    url: `/api/user/list.do`,
    method:"post",
    params:data
})



// 商品管理   
export  const  commodity = (data) => Request({
    url: `/api/product/list.do`,
    method:"get",
    params:data
})


// 品类管理   
export  const  category = (data) => Request({
    url: `/api/category/get_category.do`,
    method:"get",
    params:data
})




// 商品上架/下架  
export  const  updateStatus = (data) => Request({
    url: `/api/product/set_sale_status.do`,
    method:"post",
    params:data
})


// 商品管理中  id 或商品名称搜索 
export  const  searchIDName = (data) => Request({
    url: `/api/product/search.do`,
    method:"post",
    params:data
})



// 商品详情页
export  const  detail = (data) => Request({
    url: `/api/product/detail.do`,
    // url: `/api/product/detail.do`,
    method:"get",  
    params:data
})


// 一级品类
export  const  categoryList = (data) => Request({
    // url: `/api/product/detail.do?categoryId=${data}`,
    url: `/api/category/get_category.do`,
    method:"get",  
    params:data
})


// 添加商品
export  const  addProduct = (data) => Request({
    url: `/api/product/save.do`,
    method:"get",  
    params:data
})


// 修改商品
export  const  updataProduct = (data) => Request({
    url: `/api/product/save.do`,
    method:"get",  
    params:data
})









// 订单管理   
export  const  order = (data) => Request({
    url: `/api/order/list.do`,
    method:"get",
    params:data
})



//订单查询
export const orderId = (orderid)=>Request({
    url:`/api/order/search.do?orderNo=${orderid}`,
    method:"GET"
})










//品类添加  一级品类  二级品类
export const addcategory=(data)=>Request({
    url:"/api/category/add_category.do",
    method:"POST",
    params:data
})

//修改品类名称  一级品类  二级品类
export const setcategory=(data)=>Request({
    url:"/api/category/set_category_name.do",
    method:"get",
    params:data
})



//查看子品类
export const categoryItem=(data)=>Request({
    url:"/api/category/get_deep_category.do",
    method:"get",
    params:data
})




//商品管理搜索
export const commSearchname = (data)=>Request({
    url:`/api/product/search.do`,
    method:"GET",
    params:data
})

//新增商品product/save.do
export const addComm = (form)=>Request({
    url:`/api/product/save.do`,
    method:"POST",
    params:form
})

//商品编辑
export const updataComm = (form)=>Request({
    url:`/api/product/save.do`,
    method:"POST",
    params:form
})

//商品上架，下架
export const dataComm = (form)=>Request({
    url:`/api/product/set_sale_status.do`,
    method:"POST",
    params:form
})



//上传图片
export const upimage = (data)=>Request({
    url:`/api/product/upload.do`,
    method:"POST"
})

//品类1
export const category1 = (data)=>Request({
    url:`/api/category/get_category.do`,
    method:"GET",
    params:data
})


